package com.feedback.ui;

import android.app.ListActivity;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ImageButton;
import android.widget.TextView;
import com.feedback.UMFeedbackService;
import com.feedback.a.a;
import com.feedback.a.c;
import com.feedback.b.a;
import com.feedback.b.b;
import com.feedback.c.a;
import com.feedback.c.b;
import com.mobclick.android.j;

public class FeedbackConversations extends ListActivity
{
  private static final int c = 0;
  private static final int d = 1;
  private static final int e = 2;
  private static final int f = 3;
  private static final int g = 4;
  i a;
  ImageButton b;

  private void b()
  {
    b localb = (b)getListAdapter();
    localb.a(com.feedback.c.b.a(this));
    localb.notifyDataSetChanged();
  }

  public boolean onContextItemSelected(MenuItem paramMenuItem)
  {
    int i = ((AdapterView.AdapterContextMenuInfo)paramMenuItem.getMenuInfo()).position;
    com.feedback.b.b localb = ((b)getListAdapter()).b(i);
    switch (paramMenuItem.getItemId())
    {
    default:
    case 0:
    case 2:
    case 1:
    case 4:
    case 3:
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            return super.onContextItemSelected(paramMenuItem);
            com.feedback.c.b.a(this, localb.c);
            a.b(this, localb);
          }
          com.feedback.c.b.c(this, localb.c);
          b();
        }
        com.feedback.c.b.c(this, localb.c);
        b();
      }
      a.a(this, localb);
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(j.a(this, "layout", "umeng_analyse_feedback_conversations"));
    this.b = ((ImageButton)findViewById(j.a(this, "id", "umeng_analyse_imgBtn_submitFb")));
    if (this.b != null)
      this.b.setOnClickListener(new g(this));
    TextView localTextView = (TextView)findViewById(j.a(this, "id", "umeng_analyse_um_feedbacklist_title"));
    if (localTextView != null)
      localTextView.setText(getString(j.a(this, "string", "UMFeedbackListTitle")));
    if (!(UMFeedbackService.getHasCheckedReply()))
    {
      new a(this).start();
      new c(this).start();
    }
    registerForContextMenu(getListView());
    setListAdapter(new b(this, com.feedback.c.b.a(this)));
  }

  public void onCreateContextMenu(ContextMenu paramContextMenu, View paramView, ContextMenu.ContextMenuInfo paramContextMenuInfo)
  {
    super.onCreateContextMenu(paramContextMenu, paramView, paramContextMenuInfo);
    int i = ((AdapterView.AdapterContextMenuInfo)paramContextMenuInfo).position;
    a locala = ((b)getListAdapter()).b(i).b;
    if (locala == a.d)
    {
      paramContextMenu.add(0, 0, 0, getString(j.a(this, "string", "UMViewThread")));
      paramContextMenu.add(0, 1, 0, getString(j.a(this, "string", "UMDeleteThread")));
    }
    while (true)
    {
      do
        while (true)
        {
          return;
          if (locala != a.a)
            break;
          paramContextMenu.add(0, 2, 0, getString(j.a(this, "string", "UMViewFeedback")));
          paramContextMenu.add(0, 4, 0, getString(j.a(this, "string", "UMDeleteFeedback")));
        }
      while (locala != a.b);
      paramContextMenu.add(0, 3, 0, getString(j.a(this, "string", "UMResendFeedback")));
      paramContextMenu.add(0, 4, 0, getString(j.a(this, "string", "UMDeleteFeedback")));
    }
  }

  // ERROR //
  protected void onListItemClick(android.widget.ListView paramListView, View paramView, int paramInt, long paramLong)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: aload_2
    //   3: iload_3
    //   4: lload 4
    //   6: invokespecial 224	android/app/ListActivity:onListItemClick	(Landroid/widget/ListView;Landroid/view/View;IJ)V
    //   9: aload_0
    //   10: invokevirtual 53	com/feedback/ui/FeedbackConversations:getListAdapter	()Landroid/widget/ListAdapter;
    //   13: checkcast 55	com/feedback/ui/b
    //   16: iload_3
    //   17: invokevirtual 82	com/feedback/ui/b:b	(I)Lcom/feedback/b/b;
    //   20: astore 6
    //   22: aload 6
    //   24: monitorenter
    //   25: aload_0
    //   26: invokevirtual 53	com/feedback/ui/FeedbackConversations:getListAdapter	()Landroid/widget/ListAdapter;
    //   29: checkcast 55	com/feedback/ui/b
    //   32: iload_3
    //   33: invokevirtual 82	com/feedback/ui/b:b	(I)Lcom/feedback/b/b;
    //   36: astore 8
    //   38: aload 8
    //   40: getfield 204	com/feedback/b/b:b	Lcom/feedback/b/a;
    //   43: astore 9
    //   45: aload_0
    //   46: aload 8
    //   48: getfield 92	com/feedback/b/b:c	Ljava/lang/String;
    //   51: invokestatic 95	com/feedback/c/b:a	(Landroid/content/Context;Ljava/lang/String;)V
    //   54: invokestatic 226	com/feedback/ui/FeedbackConversations:a	()[I
    //   57: aload 9
    //   59: invokevirtual 43	com/feedback/b/a:ordinal	()I
    //   62: iaload
    //   63: tableswitch	default:+17 -> 80, 2:+27->90
    //   81: aload 8
    //   83: invokestatic 100	com/feedback/c/a:b	(Landroid/content/Context;Lcom/feedback/b/b;)V
    //   86: aload 6
    //   88: monitorexit
    //   89: return
    //   90: aload_0
    //   91: aload 8
    //   93: invokestatic 106	com/feedback/c/a:a	(Landroid/content/Context;Lcom/feedback/b/b;)V
    //   96: goto -10 -> 86
    //   99: astore 7
    //   101: aload 6
    //   103: monitorexit
    //   104: aload 7
    //   106: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   25	104	99	finally
  }

  protected void onRestart()
  {
    super.onRestart();
    b();
  }

  protected void onStart()
  {
    super.onStart();
    this.a = new i(this, (b)getListAdapter());
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("postFeedbackFinished");
    localIntentFilter.addAction("RetrieveReplyBroadcast");
    registerReceiver(this.a, localIntentFilter);
  }

  protected void onStop()
  {
    super.onStop();
    unregisterReceiver(this.a);
  }
}